package com.java123.demo.cal;

import java.util.Scanner;

public class TestShopCart {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		ShopCart sc = new ShopCart(100);
		while (true) {
			System.out.println("请输入：[0]添加商品  [1]修改商品  [2]删除商品   [3]查看当前购物车 [4]结算");
			switch (scan.nextInt()) {
			case 0:
				System.out.println("请输入：[0]火腿肠： 2.5  [1]方便面：3.5 [2]矿泉水：2.5");
				switch (scan.nextInt()) {
				case 0:
					sc.add("火腿肠", 2.5, 1);
					break;
				case 1:
					sc.add("方便面", 3.5, 1);
					break;
				case 2:
					sc.add("矿泉水", 2.5, 1);
					break;
				default:
					break;
				}
				break;
			case 1:
				System.out.println("请输入：[0]火腿肠  [1]方便面 [2]矿泉水");
				switch (scan.nextInt()) {
				case 0:
					sc.update("火腿肠", 1);
					break;
				case 1:
					sc.update("方便面", 1);
					break;
				case 2:
					sc.update("矿泉水", 1);
					break;
				default:
					break;
				}

				break;
			case 2:
				System.out.println("请输入：[0]火腿肠  [1]方便面 [2]矿泉水");
				switch (scan.nextInt()) {
				case 0:
					sc.delete("火腿肠");
					break;
				case 1:
					sc.delete("方便面");
					break;
				case 2:
					sc.delete("矿泉水");
					break;
				default:
					break;
				}

				break;
			case 3:
				System.out.println(sc.showShops());
				break;
			case 4:
				System.out.println(sc.showShops());
				System.out.println("bye!");
				scan.close();
				System.exit(0);
				break;
			default:
				break;
			}
		}
	}
}
